<template>
	<section>
		<!--工具条-->
		<el-col :span="24" class="toolbar" style="psystemLoging-bottom: 0px;">
			<el-form :inline="true" :model="filters">
				<el-form-item>
					<el-input v-model="filters.keyword" placeholder="关键字"></el-input>
				</el-form-item>
				<el-form-item>
					<el-button systemLog="primary" v-on:click="search">查询</el-button>
				</el-form-item>
			</el-form>
		</el-col>
		<!--列表-->
		<el-table :data="systemLog" highlight-current-row v-loading="listLoading" @selection-change="selsChange" style="width: 100%;">
			<el-table-column systemLog="selection" width="55">
			</el-table-column>
			<el-table-column systemLog="index" width="60">
			</el-table-column>
			<el-table-column prop="username" label="用户名" width="120" sortable>
			</el-table-column>
			<el-table-column prop="operation" label="操作" width="120" sortable>
			</el-table-column>
			<el-table-column prop="time" label="时长" width="120" sortable>
			</el-table-column>
			<el-table-column prop="method" label="方法名" width="120" sortable>
			</el-table-column>
			<el-table-column prop="ip" label="IP地址" width="120" sortable>
			</el-table-column>
			<el-table-column prop="createTime" label="操作时间" width="120" sortable>
			</el-table-column>
		</el-table>



		<!--工具条-->
		<el-col :span="24" class="toolbar">
			<el-pagination layout="prev, pager, next"
						   @current-change="handleCurrentChange"
						   :current-page="currentPage"
						   :page-size="pageSize"
						   :total="total"
						   style="float:right;">
			</el-pagination>
		</el-col>
	</section>
</template>




<!--模板区-->

<script>



    export default {
        data() {
            return {
                title:"",
                filters: {
                    keyword: ''
                },
                systemLog: [],
				total: 0,
                currentPage:1,
                pageSize: 5,
                listLoading: false,
                sels: [],//列表选中行

                systemLogFormVisible: false,//新增界面是否显示
                systemLogLoading: false,
                systemLogFormRules: {
                },
                //新增界面数据
                systemLogForm: {
                    id:null,
                    sn: '',
                    name: ""
                }

            }
        },
        /*分页和高级查询*/


        methods: {
            //高级查询定位到第一页。
            search(){
                /*定位到第一页	*/
                this.currentPage = 1;
                /*再调用分页查询得效果刷新页面*/
                this.getSystemLog();
			},
            handleCurrentChange(val) {
                this.currentPage = val;
                this.getSystemLog();
            },
            //获取日志列表
            getSystemLog() {
                let para = {//请求参数
                    currentPage: this.currentPage,
                    pageSize: this.pageSize,
                    keyword: this.filters.keyword
                };
                this.listLoading = true;//开启忙等框
                //这里发送axios请求从后端拿数据
                this.$http.post("/systemLog",para)
                    .then(result=>{
                        this.listLoading = false;//关闭忙等框
                        result = result.data;//PageList
                        this.systemLog = result.rows;
                        this.total = result.total;

                    })
                    .catch(result=>{
                        this.$message({
                            message: '操作失败！',
                            systemLog: 'error'
                        });
                    })
            },
        },
		//钩子方法
        mounted() {
            this.getSystemLog();
        }
    }

</script>

<style scoped>

</style>
